﻿Public Class Radicional

    Public Shared Function SeleccionarTodoAdiconales(ByVal descEmpresa As String, ByVal DisplaySelect As Boolean, ByVal pAdicional As Eadicional) As List(Of Eadicional)
        Dim adicinales As List(Of Eadicional) = Nothing

        Dim options As New TransactionOptions
        options.IsolationLevel = Transactions.IsolationLevel.ReadCommitted
        options.Timeout = New TimeSpan(0, 2, 0)

        Using scope As New TransactionScope(TransactionScopeOption.Required, options)
            Try
                adicinales = Dadicional.SeleccionarTodoAdiconales(descEmpresa, pAdicional)
                If adicinales Is Nothing Then adicinales = New List(Of Eadicional)
                If DisplaySelect Then adicinales.Insert(0, New Eadicional("00", "-- SELECCIONAR --"))
                scope.Complete()
            Catch ex As Exception
                Throw
            End Try
        End Using

        Return adicinales
    End Function
    Public Shared Function SelClienteConAdicionales(ByVal descEmpresa As String, ByVal DisplaySelect As Boolean, ByVal filtro As String) As List(Of Ecliente)
        Dim clienteAdicionales As List(Of Ecliente) = Nothing

        Dim options As New TransactionOptions
        options.IsolationLevel = Transactions.IsolationLevel.ReadCommitted
        options.Timeout = New TimeSpan(0, 2, 0)

        Using scope As New TransactionScope(TransactionScopeOption.Required, options)
            Try
                'clienteAdicionales = Dcliente.SelClienteConAdicionales(descEmpresa, filtro)
                If clienteAdicionales Is Nothing Then clienteAdicionales = New List(Of Ecliente)
                If DisplaySelect Then clienteAdicionales.Insert(0, New Ecliente("00", "-- SELECCIONAR --"))
                scope.Complete()
            Catch ex As Exception
                Throw
            End Try
        End Using
        Return clienteAdicionales
    End Function
    Public Shared Function Añadir(ByVal descEmpresa As String, ByVal pAdicional As Eadicional) As Boolean
        Dim resultado As Boolean = False

        Dim options As New TransactionOptions
        options.IsolationLevel = Transactions.IsolationLevel.ReadCommitted
        options.Timeout = New TimeSpan(0, 2, 0)

        Using scope As New TransactionScope(TransactionScopeOption.Required, options)
            Try
                resultado = Dadicional.Añadir(descEmpresa, pAdicional)
                scope.Complete()
            Catch ex As Exception
                Throw
            End Try
        End Using

        Return resultado
    End Function
    Public Shared Function Editar(ByVal descEmpresa As String, ByVal pAdicional As Eadicional) As Boolean
        Dim resultado As Boolean = False

        Dim options As New TransactionOptions
        options.IsolationLevel = Transactions.IsolationLevel.ReadCommitted
        options.Timeout = New TimeSpan(0, 2, 0)

        Using scope As New TransactionScope(TransactionScopeOption.Required, options)
            Try
                resultado = Dadicional.Editar(descEmpresa, pAdicional)
                scope.Complete()
            Catch ex As Exception
                Throw
            End Try
        End Using

        Return resultado
    End Function

End Class
